package com.dycong.common.leetcode.any;

/**
 * @author dycong
 * @date 2019/12/24 7:53
 */
public class BitCalcutor {

    // TODO: 2019/12/23 位运算符—与（&）、非（~）、或（|）、异或（^）
    // TODO: 2019/12/23 >>(向右位移) 针对二进制，转换成二进制后向右移动3位，>>>(无符号右移)  无符号右移，忽略符号位，空位都以0补齐
    public static void main(String[] args) {
        BitCalcutor singleNumber_iii_260 = new BitCalcutor();
        System.out.println("--------------------------");
        int i = 1;
        System.out.println(i + " : " + ~i);
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toBinaryString(~i));
        System.out.println("--------------------------");

        i = 0;
        System.out.println(i + " : " + ~i);
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toBinaryString(~i));
        System.out.println("--------------------------");

        i = Integer.MAX_VALUE;
        System.out.println(i + " : " + ~i);
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toBinaryString(~i));
        System.out.println("--------------------------");

        i = Integer.MIN_VALUE;
        System.out.println(i + " : " + ~i);
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toBinaryString(~i));
        System.out.println("--------------------------");
    }

}
